//
//  NSDate+util.m
//  iBaby365v2
//
//  Created by Kirinrin on 14-7-31.
//  Copyright (c) 2014年 suplus. All rights reserved.
//

#import "NSDate+util.h"

@implementation NSDate (util)
+(instancetype)instanceWithString:(NSString *)dateString dateFormat:(NSString*) formatString{
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    if (dateString) {
        [formatter setDateFormat:formatString];
    }
    
    return [formatter dateFromString:dateString];
}

-(NSString *)stringWithDatetimeFormate{
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    return [formatter stringFromDate:self];
}
-(NSString *)stringWithDateFormate{
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    formatter.dateFormat = @"yyyy-MM-dd";
    return [formatter stringFromDate:self];
}
-(NSString *)stringWithDatetimeFormate:(NSString *)formatString{
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    formatter.dateFormat = formatString;
    return [formatter stringFromDate:self];
}

@end
